prepare-root: Move metadata for root transient into lib
authorColin Walters <walters@verbum.org>
Tue, 24 Jun 2025 20:29:45 +0000 (16:29 -0400)
committerColin Walters <walters@verbum.org>
Tue, 24 Jun 2025 20:39:14 +0000 (16:39 -0400)
Prep for soft reboots.

Signed-off-by: Colin Walters <walters@verbum.org>
src/libotcore/otcore-prepare-root.c
src/switchroot/ostree-prepare-root.c

index a82e16d28fd903100c7eca2d629ce210b37dde7e..3efdf576ba1207a725256ce2b63d321d233179e2 100644 (file)
@@ -377,6 +377,10 @@ otcore_mount_rootfs (ComposefsConfig *composefs_config, GVariantBuilder *metadat
   g_variant_builder_add (metadata_builder, "{sv}", OTCORE_RUN_BOOTED_KEY_BACKING_ROOTDEVINO,
                          g_variant_new ("(tt)", (guint64)stbuf.st_dev, (guint64)stbuf.st_ino));
 
+  /* Pass on the state  */
+  g_variant_builder_add (metadata_builder, "{sv}", OTCORE_RUN_BOOTED_KEY_ROOT_TRANSIENT,
+                         g_variant_new_boolean (root_transient));
+
   bool using_composefs = FALSE;
 #ifdef HAVE_COMPOSEFS
   /* We construct the new sysroot in /sysroot.tmp, which is either the composefs
index fb38f095777adf23708219e6f915f66e0f103065..7f350412fca0473957f953206f119154bd88c78b 100644 (file)
@@ -281,10 +281,6 @@ main (int argc, char *argv[])
         err (EXIT_FAILURE, "failed to make initial bind mount %s", deploy_path);
     }
 
-  /* Pass on the state  */
-  g_variant_builder_add (&metadata_builder, "{sv}", OTCORE_RUN_BOOTED_KEY_ROOT_TRANSIENT,
-                         g_variant_new_boolean (root_transient));
-
   /* Pass on the state for use by ostree-prepare-root */
   g_variant_builder_add (&metadata_builder, "{sv}", OTCORE_RUN_BOOTED_KEY_SYSROOT_RO,
                          g_variant_new_boolean (sysroot_readonly));